    /**
   * 模板导出按钮添加
   * 参数模板
   * [{
            condition:()=>{
                return mstform.getItem("u_js_type").getValue() == '1'
            },
            param:``,
}],
  */
  function toMbIn(tabelHeader,tableName,btnId,params,premise){
    const toolbar_dgrid = $NG.getCmpApi("toolbar_"+tableName)
      toolbar_dgrid.insert({
            id: btnId,
            text: "导出",
            iconCls: "icon-InsertRow",
        });
        useClick(async function ({ args }) {
            if(premise&&!premise()){
                return false
            }
            // 获取项目选择的值
            const phid = $NG.getCmpApi(tabelHeader).getValues().phid; // 动态获取的项目选择值
            if(!phid){
                $NG.alert("请先保存！")
                return false
            }
            // 构造 URL 参数
            const url = window.location.href;
            const protocol = $NG.split(url, "/")[0]; // 协议类型
            const url_domain = $NG.split(url, "/")[2]; // 直接提取域名部分
            const url_path = "/report/index.html#/tableDesign/TableManager/preview"; // 路径
            let param = null
            if(params instanceof Array){
                params.forEach(item=>{
                    const bool = item.condition()
                    if(bool){
                        if(item.param instanceof Object){
                            param = {...item.param}
                        } else {
                            param = JSON.parse(item.param)
                        }
                    }
                })
            } else {
                if(params instanceof Object){
                    param = params
                } else {
                    param = JSON.parse(params)

                }
            }
            for(let key in param){
                if(param[key] instanceof Object){
                   param[key] = JSON.stringify(param[key]) 
                }
                if(key == 'queryParamList'){
                    param['linkParams'] = param['queryParamList']
                    delete param['queryParamList']
                } else if(key == 'reportId'){
                    param['rep_id'] = param['reportId']
                    delete param['reportId']
                }
            }
            const query_params = new URLSearchParams(param).toString(); // 使用 URLSearchParams 来构造查询参数

            // 打开报表并传递参数
            console.log(`跳转连接`,`${protocol}//${url_domain}${url_path}?${query_params}`);
            $NG.open(`${protocol}//${url_domain}${url_path}?${query_params}`, { AppTitle: "模板导出" });
        }, btnId);
  }